'''
Created on 2011-1-6

@author: Administrator
'''
import config
from util import DB
def loadLogItem(path="../"+config.data_dir + config.purged_log_sql,tbname=config.purged_log_tbname):
    cur = DB.getCur()
    cur.execute("truncate %s"%tbname)
    f=open(path,'r')
    a=0
    for line in f.readlines(): 
        #print line
        try:
            cur.execute(line)
        except Exception:
            a+=1
            print "error:  "+line
            continue
    print a
if __name__ == '__main__':
    loadLogItem()